# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

_pkgname=PageEdit
pkgname=${_pkgname,,}
pkgver=1.9.20
pkgrel=1
pkgdesc='Simple Single Page XHTML Visual Editor, split from Sigil’s BookView'
arch=(loong64 x86_64)
url="https://github.com/Sigil-Ebook/$_pkgname"
license=(GPL3)
depends=(qt6-5compat
         qt6-svg
         qt6-webengine)
makedepends=(cmake
             qt6-tools)
_archive="$_pkgname-$pkgver"
source=("$url/archive/$pkgver/$_archive.tar.gz"
        "$url/releases/download/$pkgver/$_archive.tar.gz.sig")
sha256sums=('87c9adf784fab7e03f1cb3368fda8d817fd918de90ea7ea7ebe115f365fabb6c'
            'SKIP')
validpgpkeys=('B5A56206AB0FBC1A24EFAB8AA166D29A8FCDAC63') # Doug Massay <douglaslmassay@gmail.com>

prepare() {
	cd "$_archive"
	mkdir -p "build"
}

build() {
	cd "$_archive/build"
	cmake \
		-G "Unix Makefiles" \
		-D CMAKE_BUILD_TYPE=Release \
		-D USE_QT6=1 \
		-D CMAKE_INSTALL_PREFIX=/usr \
		-D CMAKE_INSTALL_LIBDIR=lib \
		-D INSTALL_BUNDLED_DICTS=0 \
		-D CMAKE_C_FLAGS="$CFLAGS" \
		-D CMAKE_CXX_FLAGS="$CXXFLAGS" \
		..
	make
}

package() {
	cd "$_archive/build"
	make install DESTDIR="$pkgdir"
}
